package com.zhuzx;

import com.zhuzx.common.ConfigKeeper;
import io.netty.bootstrap.ServerBootstrap;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author zhuZX
 * @date 2021/1/31 10:39
 * @description
 */
@SpringBootApplication
public class ServerBoot{

    private static final String ZOOKEEPER_ADDRESS = "127.0.0.1:2181";
    private static final int DEFAULT_REPORT_INTERVAL = 5;

    public static void main(String[] args) throws Exception {
        int port = 8990;
        if (args.length > 0 && NumberUtils.isDigits(args[0])) {
            port = Integer.parseInt(args[0]);
        }

        ConfigKeeper configKeeper = ConfigKeeper.getInstance();
        configKeeper.setPort(port);
        configKeeper.setZkAddr(ZOOKEEPER_ADDRESS);
        configKeeper.setProviderSide(true);

        SpringApplication.run(ServerBoot.class, args);
    }
}
